/*---------------------删除信息-------------------*/
$(document).on('touchstart','.rechargeDeleteImg',function(){
	$(this).parent().remove();
	var str = '<div class="addInfoBtn"><img src="'+$('#bankCard').val()+'" alt="" /><p>点击添加银行卡信息</p></div>';
	$('.container').html(str);
	$.ajax({
		type:"get",
		url:"/weishang/supplier/deleteBankInfoAction",
		async:true,
		data:{
			'accountName':null,
			'accountBank':null,
			'accountCard':null
		},
		success:function(data){
		}
	});
})

/*---------------------弹出弹框------------------*/
$(document).on('touchstart','.addInfoBtn',function(){
	$('.commonBg').show();
	$('.fillAndBtn').show();
	$('html').css('overflow','hidden');
	$('body').css('overflow','hidden');
})
//隐藏弹框
$(document).on('touchstart','.btnCancel',function(){
	$('.fillAndBtn').hide();
	$('.commonBg').hide();
	$('html').css('overflow-y','scroll');
	$('body').css('overflow-y','scroll');
})
/*提交信息*/
$(document).on('touchstart','.btnSubmit',function(){
	var status = true;
	var aInput = $('.input');
	var arrInfo = new Array();
	var arrCode = new Array();
	for(var i = 0,len = aInput.length;i < len;i ++){
		if(!Boolean(aInput.eq(i).val())){
			jQuery.fn.myTip(4,{toast:'请将信息填写完整'});
			$('.toast').css({
				'color':'#fff'
			})
			status = false;
		}else{
			arrInfo[i] = aInput.eq(i).val().replace(/\s+/g, "");
		}
	}
	if(status){
		//进行ajax提交
		/*for(var j = 0,lan = arrInfo[2].length/4;j < lan;j ++){
			arrCode[j] = arrInfo[2].toString().substr(j*4,4);
		}*/
		//arrCode数组为分割好的银行卡号
		$.ajax({
			type:"get",
			url:"/weishang/supplier/addBankInfoAction",
			async:true,
			data:{
				'accountName':arrInfo[0],
				'accountBank':arrInfo[1],
				'accountCard':arrInfo[2]
			},
			success:function(res){
				$('.fillAndBtn').hide();
				$('.commonBg').hide();
				$('html').css('overflow-y','scroll');
				$('body').css('overflow-y','scroll');
				window.location.href="/weishang/supplier/bankSet.htm";
			}
		});
	}
})
